<?php
	$cs = Yii::app()->getClientScript();
	$cs->registerScriptFile('/js/rating.js');

	$configStarRaiting  = array(
		// 'name' => 'Review['.$attribute.']',
		// 'model'=>$review,
		// 'attribute'=>$attribute,
		'minRating' => '1',
		'maxRating' => '10',
		// 'value' => ($readOnly == false) ? NULL : $model->GetFormattedRating($attribute),
		'starWidth'=>'18',
		'ratingStepSize' => '1',
		'allowEmpty'=>false,
		'readOnly'=>$readOnly,
		'cssFile'=>'/css/rating/jquery.rating.css',
	);
	$attributes = array(
		'rating_accuracy',
		'rating_communication',
		'rating_cleanliness',
		'rating_location',
		'rating_check_in',	
		'rating_review'
	);
?>
<div id="rating_num">
	<div style="width:<?php echo $rating; ?>%;"><span></span></div>
</div>
<table class="rate_table">
	<tr>
		<td><?php echo Yii::t("main", "Accuracy")?></td>
		<td>
			<div class="rating_num_min">
				<?php
					$attribute = 'rating_accuracy';
					if($model->CheckReview()){
						$configStarRaiting['model'] = $review;
						$configStarRaiting['attribute'] = $attribute;
						
					}
					else
					{
						$configStarRaiting['name'] = 'Review['.$attribute.']';
						$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
					}
					$this->widget('CStarRating', $configStarRaiting);
				?>
			</div>
		</td>
		<td><?php echo Yii::t("main", "Communication")?></td>
		<td>
			<div class="rating_num_min">
				<?php
					$attribute = 'rating_communication';
					if($model->CheckReview()){
						$configStarRaiting['model'] = $review;
						$configStarRaiting['attribute'] = $attribute;
						
					}
					else
					{
						$configStarRaiting['name'] = 'Review['.$attribute.']';
						$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
					}
					$this->widget('CStarRating', $configStarRaiting);
				?>
			</div>
		</td>
	</tr>
	<tr>
		<td><?php echo Yii::t("main", "Cleanliness")?></td>
		<td>
			<div class="rating_num_min">
				<?php
					$attribute = 'rating_cleanliness';
					if($model->CheckReview()){
						$configStarRaiting['model'] = $review;
						$configStarRaiting['attribute'] = $attribute;
						
					}
					else
					{
						$configStarRaiting['name'] = 'Review['.$attribute.']';
						$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
					}
					$this->widget('CStarRating', $configStarRaiting);
				?>
			</div>
		</td>
		<td><?php echo Yii::t("main", "Location")?></td>
		<td>
			<div class="rating_num_min">
				<?php
					$attribute = 'rating_location';
					if($model->CheckReview()){
						$configStarRaiting['model'] = $review;
						$configStarRaiting['attribute'] = $attribute;
						
					}
					else
					{
						$configStarRaiting['name'] = 'Review['.$attribute.']';
						$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
					}
					$this->widget('CStarRating', $configStarRaiting);
				?>
			</div>
		</td>
	</tr>
	<tr>
		<td><?php echo Yii::t("main", "Check In")?></td>
		<td>
			<div class="rating_num_min">
				<?php
					$attribute = 'rating_check_in';
					if($model->CheckReview()){
						$configStarRaiting['model'] = $review;
						$configStarRaiting['attribute'] = $attribute;
						
					}
					else
					{
						$configStarRaiting['name'] = 'Review['.$attribute.']';
						$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
					}
					$this->widget('CStarRating', $configStarRaiting);
				?>
			</div>
		</td>
		<td><?php echo Yii::t("main", "Value")?></td>
		<td>
			<div class="rating_num_min">
				<?php
					$attribute = 'rating_review';
					if($model->CheckReview()){
						$configStarRaiting['model'] = $review;
						$configStarRaiting['attribute'] = $attribute;
						
					}
					else
					{
						$configStarRaiting['name'] = 'Review['.$attribute.']';
						$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
					}
					$this->widget('CStarRating', $configStarRaiting);
				?>
			</div>
		</td>
	</tr>
</table>